GETSOCKNAME

Section: System Calls (2)
Index Return to Main Contents

BSD mandoc
BSD 4.2  

NAME

getsockname - get socket name  

SYNOPSIS

Ft int Fn getsockname int s struct sockaddr *name int *namelen  

DESCRIPTION

Fn Getsockname returns the current Fa name for the specified socket. The Fa namelen parameter should be initialized to indicate the amount of space pointed to by Fa name . On return it contains the actual size of the name returned (in bytes).  

DIAGNOSTICS

A 0 is returned if the call succeeds, -1 if it fails.  

ERRORS

The call succeeds unless:

Bq Er EBADF
The argument Fa s is not a valid descriptor.
Bq Er ENOTSOCK
The argument Fa s is a file, not a socket.
Bq Er ENOBUFS
Insufficient resources were available in the system to perform the operation.
Bq Er EFAULT
The Fa name parameter points to memory not in a valid part of the process address space.

 

SEE ALSO

bind(2), socket(2)  

BUGS

Names bound to sockets in the UNIX domain are inaccessible; getsockname returns a zero length name.  

HISTORY

The Fn getsockname function call appeared in BSD 4.2


 

Index

NAME
SYNOPSIS
DESCRIPTION
DIAGNOSTICS
ERRORS
SEE ALSO
BUGS
HISTORY

This document was created by man2html, using the manual pages.
Time: 16:28:59 GMT, April 18, 2022